<!DOCTYPE html>
<html lang="zh-CN">

<head>
	<#include file="include.html" />
	<title>MVC案例</title>
</head>

<body style="background-color: #F2F2F2">
	<div style="text-align: center;">
		<image src="image/logo.png" style="width: 200px; height: 200px;"></image>
	</div>

	<form class="layui-form">
		<div style="margin-left: auto; margin-right: auto; width: 350px;">
			<div class="layui-card">
				<div class="layui-card-header">登录</div>
				<div class="layui-card-body">
					<table style="width: 100%;">

						<tr>
							<td style="width: 60px;">账号</td>
							<td>
								<div class="col-md-12" style="margin: 4px">
									<input type="text" class="layui-input" style="width: 100%;" lay-verify="required"
										placeholder="" lay-verType="tips" name="username" />
								</div>
							</td>
						</tr>
						<tr>
							<td style="width: 60px;">密码</td>
							<td>
								<div class="col-md-12" style="margin: 4px">
									<input type="password" class="layui-input" style="width: 100%;"
										lay-verify="required" lay-verType="tips" name="pwd" />
								</div>
							</td>
						</tr>
						<tr>
							<td style="width: 60px;">验证码</td>
							<td>
								<div class="col-md-12" style="margin: 4px">
									<input type="text" class="layui-input" style="width: 100%;" lay-verify="required"
										placeholder="" lay-verType="tips" name="vcode" maxlength="4" />
								</div>
							</td>
						</tr>
						<tr>
							<td style="width: 60px;"></td>
							<td>
								<div class="col-md-12" style="margin: 4px">
									<img id="imgid" style="cursor:pointer;width:90px;height: 35px;"
										onclick="changevcode()">
								</div>
							</td>
						</tr>

						<tr>
							<td style="width: 60px;"></td>
							<td>

								<div style="float: right; text-align: right; margin: 8px;">

									<button id="btnreg" lay-submit lay-filter="save" class="layui-btn">登录</button>
		
								</div>
							</td>
						</tr>
					</table>
					账号:admin 密码:admin
				</div>
			</div>
		</div>

	</form>
	<script>

		var form = layui.form;
		layui.use('form', function () {
			form.render("checkbox");
			changevcode();
			
		});

		form.on('submit(save)', function (data) {

			var ds = data.field;
			$.post("check", ds, function (ret) {

				if (ret.code == 0) {
					window.location = "Main/";
				} else {
					changevcode();
					layer.msg(ret.message);
				}
			});
			return false;
		});

		form.on('submit(save1)', function (data) {

			var ds = {"mz_date": 1647580827000,"_id": "","mz_minxi": [{"zd_name": "75%乙醇消毒液","zd_guige": "500ml","zd_fac": "xxxxxxxx制品有限公司",}]};
			$.post("getdata",ds, function (ret) {

				layer.msg(ret.message);
			});
			return false;
		});
		function changevcode() {			
			var randomnum = Math.random();
			$.get("/verifycode?d=" + randomnum, function (ret) {
				var img = document.getElementById("imgid");				
				img.src = ret;
			});


		}
	</script>
</body>


</html>